import APP from "./appConfig"
import { Indicator } from 'mint-ui';
function JSONP(url,params,jsoncallback,headParms){
  Indicator.open({
    text:'loading...',
    spinnerType: 'fading-circle',
  })
  return $.ajax({
    url:url,
    type:'get',
    dataType:'jsonp',
    data:{...params},
    jsonp: jsoncallback,
  }).then((res)=>{
    Indicator.close()
    return res
  }).catch(err=>{
    Indicator.close()
    return err
  })
}
function Post(url,params,headParms){
  Indicator.open({
    text:'loading...',
    spinnerType: 'fading-circle',
  })
  var a={
    url:url,
    type:'POST',
    ...headParms,
    data:{...params},
    crossDomain: true
  }
  console.log('a',a)
  return $.ajax({
    url:url,
    type:'POST',
    ...headParms,
    data:{...params},
    crossDomain: true
  }).then(res=>{
    Indicator.close()
    return res
  }).catch(err=>{
    Indicator.close()
    return err
  })
}
export {JSONP, Post }

